Skip to content

I completed the assignment#3

Open
kriseattle wants to merge 4 commits intoauberonedu:mainfrom
kriseattle:main
Open

I completed the assignment#3
kriseattle wants to merge 4 commits intoauberonedu:mainfrom
kriseattle:main

Conversation

@kriseattle
Copy link
Copy Markdown

I followed the instructions and completed the assignment

Comment thread src/Practice.java
Comment on lines 80 to +96
public static boolean allStartWithA(String[] words) {
// TODO: Delete the dummy return statement and implement this method here!
return false;
}

//return true if array is empty
if (words.length == 0){
return true;
}

//use for loop to loop through every word to check if the word starts with A
for (int i = 0; i < words.length; i++){
if (words[i].startsWith("A")){
return true;
}
}
return false;

}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea and this passes the provided examples, but I don't think it works in the general case. Can you consider what would happen with this input?

allStartWithA(new String[]{"alligators", "are", "awesome"})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants